package com.abso.mp3tunes.locker.core.services;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

/**
 * Utilities methods for invocation services.
 */
public class ServiceUtils {

	/**
	 * Encodes a URL parameter using the UTF-8 encoding.
	 * 
	 * @param param
	 *            the parameter being encoded.
	 * @return the encoded parameter.
	 * @throws UnsupportedEncodingException
	 *             if the parameter cannot be encoded.
	 */
	public static String encodeURLParameter(String param)
			throws UnsupportedEncodingException {
		String encodedPath = URLEncoder.encode(param, "UTF8");
		encodedPath = encodedPath.replaceAll("\\+", "%20");
		return encodedPath;
	}

}
